import { defineStore } from 'pinia';

export const useAirwayCleanStore = defineStore('airwayClean', () => {
  // 步骤一状态：是否已检查机组控制屏
  const stepOneStatus = ref(false);
  
  // 步骤二状态：是否已清理风道
  const stepTwoStatus = ref(false);
  
  // 步骤三状态：是否已查看趋势曲线
  const stepThreeStatus = ref(false);
  
  // 清理状态：是否正在清理中
  const isCleaning = ref(false);

  // 获取步骤一状态
  const getStepOneStatus = computed(() => stepOneStatus.value);
  
  // 获取步骤二状态
  const getStepTwoStatus = computed(() => stepTwoStatus.value);
  
  // 获取步骤三状态
  const getStepThreeStatus = computed(() => stepThreeStatus.value);
  
  // 获取清理状态
  const getIsCleaning = computed(() => isCleaning.value);

  // 完成步骤一
  const completeStepOne = () => {
    stepOneStatus.value = true;
  };
  
  // 完成步骤二
  const completeStepTwo = () => {
    stepTwoStatus.value = true;
  };
  
  // 完成步骤三
  const completeStepThree = () => {
    stepThreeStatus.value = true;
  };
  
  // 设置清理状态
  const setCleaningStatus = (status) => {
    isCleaning.value = status;
  };
  
  // 重置所有状态
  const resetAllStatus = () => {
    stepOneStatus.value = false;
    stepTwoStatus.value = false;
    stepThreeStatus.value = false;
    isCleaning.value = false;
  };

  return {
    // 状态
    stepOneStatus,
    stepTwoStatus,
    stepThreeStatus,
    isCleaning,
    
    // Getters
    getStepOneStatus,
    getStepTwoStatus,
    getStepThreeStatus,
    getIsCleaning,
    
    // Actions
    completeStepOne,
    completeStepTwo,
    completeStepThree,
    setCleaningStatus,
    resetAllStatus
  };
});

// 导入必要的函数
import { ref, computed } from 'vue';